import java.util.Random;

public class Dedao {
    private Dedao(){}

    public static void show(Human person)//展示信息
    {
        System.out.printf("\n");
        System.out.println("姓名：" + person.getname());
        System.out.println("性别：" + person.getgender());
        System.out.println("年龄：" + person.getage());
        System.out.println("天赋：" + person.gettalent());
        System.out.println("境界：" + person.getrealm());
        System.out.printf("\n");
    }

    public static String makename()//生成姓名
    {
        Random r = new Random();
        String[] xing = {"赵","钱","孙","李","周","吴","郑","王","上官","申屠","司马","诸葛","夏侯"} ;//姓
        String[] ming_s = {"壹","贰","叁","肆","伍","陆","柒","捌","玖","拾"} ;//名1
        String[] ming_e = {"松","梅","柏","竹","菊","霜","霏","霖","雪"};//名2
        String[][] all = {xing,ming_s,ming_e};
        String name = "";
        int m = r.nextInt(2) + 2;//2 ~ 3
        int n = 0;
        int i = 0;
        for(i = 0;i < m;i++)//随机组合
        {
            n = r.nextInt(all[i].length);
            name += all[i][n];
        }
        return name;
    }

    public static String makegender()//生成性别
    {
        Random r = new Random();
        String gender = "";
        int i = 0;
        i = r.nextInt(3);//0 ~ 2
        switch (i) {
            case 0:gender = "男";break;
            case 1:gender = "女";break;
            default:gender = "未知";break;
        }
        return gender;
    }

    public static int makeage()//生成年龄
    {
        Random r = new Random();
        int age = 0;
        int layer = r.nextInt(4) + 2;//2 ~ 5
        int i  = 0;
        int num = 0;
        int ten = 1;
        for(i = 0;i < layer;i++)//随机年龄（0 ~ 99999）
        {
            num = r.nextInt(10);
            age += num * ten;
            ten *= 10;
        }
        return age;
    }

    public static String maketalent()//生成天赋
    {
        Random r = new Random();
        String[] list = {"碌碌无为","颇具根骨","灵韵内敛","无垢之躯","天生道体"};//天赋表
        int i  = 0;
        i = r.nextInt(15) + 1;//1 ~ 15
        int j = 0;
        for(j = 0;i > 0;j++)
        {
            i -= (j + 1);//1、2 ~ 3、4 ~ 6、7 ~ 10、11 ~ 15
        }
        String talent = list[5 - j];
        return talent;
    }

    public static String level(Human human)//计算境界
    {
        Random r = new Random();
        String realm = "";
        long num = 0;
        long sum = 0;
        int i = 0;
        String[] list = {"凡俗","筑基","金丹","元婴","化神","大乘","天仙"};//境界表
        switch (human.gettalent()) {
            case "碌碌无为": num = r.nextInt(9) + 1;break;//1 ~ 9
            case "颇具根骨": num = r.nextInt(990) + 10;break;//10 ~ 999
            case "灵韵内敛": num = r.nextInt(99000) + 1000;break;//1000 ~ 99999
            case "无垢之躯": num = r.nextInt(9900000) + 100000; break;//100000 ~ 9999999
            case "天生道体": num = r.nextInt(990000000) + 10000000; break;//10000000 ~ 999999999
            default:break;
        }
        sum = num * human.getage();
        for(i = 0;sum > 0;i++)
        {
            sum /= 100;
        }
        realm = list[i - 1];
        return realm;
    }
}
